package com.bwie.coupon.controller;

import com.bwie.common.core.domain.Result;
import com.bwie.coupon.service.MlCouponService;
import com.bwie.coupon.service.MlUserCouponService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RequestMapping("/mlUserCoupon")
@RestController
@CrossOrigin
@Log4j2
public class MlUserCouponController {

    @Autowired
    private MlUserCouponService mlUserCouponService;
    @Autowired
    private HttpServletRequest request;

    /**
     * 用户领取优惠卷
     * @return
     */
    @GetMapping("/mlUserCouponAdd/{mlCouponId}")
    public Result mlUserCouponAdd(@PathVariable Integer mlCouponId) {
        log.info("方法名称：用户领取优惠卷,请求URL:{},请求放方式:{},请求参数:{}",
                request.getRequestURI(),request.getMethod(),mlCouponId);
        mlUserCouponService.mlUserCouponAdd(mlCouponId);
        Result success = Result.success();
        log.info("方法名称：用户领取优惠卷,请求URL:{},请求放方式:{},响应结果:{}",
                request.getRequestURI(),request.getMethod(),success);
        return Result.success();
    }




}
